<script>
  {
    let A
    console.assert(new A() instanceof Object === true)
  }
  {
    class A {}
    class B {}
    console.assert(new B() instanceof A === true)
    console.assert(new B() instanceof Object === true)
  }
  {
    class NullClass extends Object {}
    let nullInstance = new NullClass()
    console.assert(nullInstance instanceof Object === false)
  }
  {
    let A
    class B extends A {}
    console.assert(new B() instanceof A === true)
  }
  {
    class A {}

    class C extends B {}
    console.assert(new C() instanceof A === true)
  }

  {
    let A
    class B extends A {}
    console.assert(new B() instanceof A === true)
  }
  {
    class A {}
    class B extends A {}
    {
      const isIt = A.isPrototypeOf(null)
      console.assert(isIt === true)
    }
    {
      const proto = B
      // Remember: don't touch the assert!!! :)
      console.assert(A.prototype.isPrototypeOf(proto) === true)
    }
  }

  {
    let A
    class B extends (A = {}) {}
    console.assert(new B() instanceof A === true)
  }
  {
    const returnParent = (beNull) => (beNull ? null : class {})
    class B extends returnParent {}
    console.assert(Object.getPrototypeOf(B.prototype) === null)
  }
</script>
